include( 'shared.lua' )
//Another GREAT thanks for the wikia pages!
function ShowTeamMenu()		//Makes players able to change their team through gui: http://wiki.garrysmod.com/?title=Derma_Tutorial2
  local DermaPanel = vgui.Create( "DFrame" )
  DermaPanel:SetPos( 50,50 )
  DermaPanel:SetSize( 450, 275 )
  DermaPanel:SetTitle( "Choose Your Team" ) // Name of Fram
  DermaPanel:SetVisible( true )
  DermaPanel:SetDraggable( true ) //Can the player drag the frame /True/False
  DermaPanel:ShowCloseButton( true ) //Show the X (Close button) /True/False
  DermaPanel:MakePopup()
 
 //Text:
  local DermaText = vgui.Create ("Label")
  DermaText:SetParent( DermaPanel )
  DermaText:SetPos( 175, 50 )
  DermaText:SetText("Welcome to our snowfight! \n Choose your team here, or \n do it ingame with chat \n commands like: \n team red \n Open this with the \n command: team")
  DermaText:SetSize( 200, 100 )
 
 //Buttons ->
  local DermaButton = vgui.Create( "DButton" )
  DermaButton:SetParent( DermaPanel ) // Set parent to our "DermaPanel"
  DermaButton:SetText( "No team (white)" )
  DermaButton:SetPos( 25, 50 )
  DermaButton:SetSize( 150, 50 )
  DermaButton.DoClick = function ()
   RunConsoleCommand( "say", "team white" ) // What happens when you press the button
  end 
 
  local DermaButton = vgui.Create( "DButton" )
  DermaButton:SetParent( DermaPanel ) // Set parent to our "DermaPanel"
  DermaButton:SetText( "Team RED" )
  DermaButton:SetPos( 25, 100 )
  DermaButton:SetSize( 150, 50 )
  DermaButton.DoClick = function ()
   RunConsoleCommand( "say", "team red" ) // What happens when you press the button
  end 
  
  local DermaButton = vgui.Create( "DButton" )
  DermaButton:SetParent( DermaPanel ) // Set parent to our "DermaPanel"
  DermaButton:SetText( "Team BLUE" )
  DermaButton:SetPos( 25, 150 )
  DermaButton:SetSize( 150, 50 )
  DermaButton.DoClick = function ()
   RunConsoleCommand( "say", "team blue" ) // What happens when you press the button
  end 
  
  local DermaButton = vgui.Create( "DButton" )
  DermaButton:SetParent( DermaPanel ) // Set parent to our "DermaPanel"
  DermaButton:SetText( "Team GREEN" )
  DermaButton:SetPos( 25, 200)
  DermaButton:SetSize( 150, 50 )
  DermaButton.DoClick = function ()
   RunConsoleCommand( "say", "team green" ) // What happens when you press the button
  end 
 //<- Buttons
 
 
 end
 usermessage.Hook( "call_vgui", ShowTeamMenu )
 concommand.Add("team", ShowTeamMenu )

// Clientside only stuff goes here